package com.zhiyou100.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhiyou100.model.User;
import com.zhiyou100.service.UserService;
import com.zhiyou100.vo.ResponseVo;

@RestController
public class UserController {

	@Autowired
	private UserService userService;
	
	public ResponseVo<User> login(@RequestBody User user,HttpSession session){
		User savedUser = userService.login(user);
		
		session.setAttribute("loginUser", savedUser);
		
		
		return new ResponseVo<>(200,"登录成功",null);
		
		
	}
}
